<?php echo $this->render('link/header.phtml') ?>
//常用变量初始化
var menuDelUrl=baseUrl+"/link/serversite/type/del";
var menuEditUrl=baseUrl+"/link/serversite/type/edit";
var module="site";
var gridTitle="网站类型列表";
var dataId="site_id";
var site = Ext.data.Record.create([
           {name: 'site_id', type: 'int'},
           {name: 'site_type', type: 'string'}
      ]);

   
var ds=new Ext.data.Store({
							  proxy:new Ext.data.HttpProxy({
									url:baseUrl+'/link/serversite/'
									}),
							  reader:new Ext.data.JsonReader({
									root:'results',
									totalProperty:'total',
									id:'u_id'
									},site)
	});		 
//定义列模型
var cm=new Ext.grid.ColumnModel([	
							new Ext.grid.RowNumberer(),	
                            {header:'类型ID',dataIndex:'site_id',width:130},
                           	{header:'网站类型',dataIndex:'site_type',width:180,editor:new Ext.form.TextField({allowBlank:false})}							
	]);
cm.defaultSortable = true; 



//定义工具栏								 
var tb=new Ext.Toolbar({
							items:[

                                         {
                                            id:'menuDel'+ExtId,
											text:'删除',
											iconCls:'icn-delete',
											handler:menuDel
											},{
											id:'menu_save'+ExtId,
											text:'保存',	
											iconCls:'icn-edit',
											disabled:true,
											handler:menuSave
											},{
											xtype:'tbfill'
											},{
                                            id:'menu_quickadd'+ExtId,
											text:'快速添加',
											iconCls:'icn-add',
											handler:menuAddQuick
										}
											 
								 ]
	});			
   
function  menuAdd(){

}		
function menuAddQuick(){
	
	var n = grid.getStore().getCount();// 获得总行数
                var p = new site({
                	site_id:"",
                    site_type:""
                });
                grid.stopEditing();// 停止编辑
                ds.insert(n, p);// 插入到最后一行
                grid.startEditing(n, 1);// 开始编辑1单元格
				Ext.getCmp('menu_save'+ExtId).setDisabled(false);
	}			      
<?php echo $this->render('link/foot.phtml') ?>
